/** options 管理 */
export default {
  data: vm => ({
    // 可选项
    options: {
      campus: [],
      department: [],
      passArea: [],
      garage: [],
      businessType: []
    }
  }),
  methods: {
    // 获取校区
    async getCampusOptions () {
      this.options.campus = (await this.$api.commonApi.campusList()).data.map(item => ({
        ...item,
        label: item.name,
        value: String(item.id)
      }))
      return this.options.campus
    },
    // 获取部门
    async getDepartmentOptions () {
      this.options.department = (await this.$api.commonApi.delpartment()).data.map(item => ({
        ...item,
        label: item.deptName,
        value: String(item.deptName)
      }))
      return this.options.department
    },
    // 获取片区
    async getPassAreaOptions () {
      this.options.passArea = (await this.$api.commonApi.passAreaList()).data.map(item => ({
        ...item,
        label: item.name,
        value: item.id
      }))
      return this.options.passArea
    },
    // 获取车库
    async getGarageOptions () {
      this.options.garage = (await this.$api.commonApi.garageList()).data.map(item => ({
        ...item,
        label: item.name,
        value: item.id
      }))
      return this.options.garage
    },
    // 获取车库
    async getbusinessTypeOptions () {
      this.options.businessType = (await this.$api.commonApi.businessTypeList()).data.map(item => ({
        ...item,
        label: item.label,
        value: item.value
      }))
      return this.options.businessType
    }
  }
}
